<form action="<{link app=b2c ctl=site_member act=save_company}>" method="post" class="form-handling" id="member_address_form">
  <input type="hidden" value="<{$company_id}>" name="company_id">

      <label for=""><em class="text-warn">*</em> <{t}>公司类型：<{/t}></label>
		<div class="radio">
		<label for="o1">
		<input onclick="change1()" type="radio" id="o1" class="choice" name="c_type" value=0 <{if $c_type==0}>checked<{/if}>><{t}>Юр. лицо<{/t}></label>
		</div>
		<div class="radio" onclick="">
		<label for="o3">
		<input onclick="change2()" type="radio" id="o3" class="choice" name="c_type" value=2 <{if $c_type==2}>checked<{/if}>><{t}>ИП<{/t}></label>
		</div>
		<div class="radio">
		<label for="o4">
		<input type="radio" id="o4" class="choice" name="c_type" value=3 <{if $c_type==3}>checked<{/if}>><{t}>个人<{/t}></label>
		</div>


		<div class="form-group">
		<label for=""  ><em class="text-warn">*</em> <{t}>付款人名称：<{/t}></label>
		<input type="text" name="name" id="" value="<{$name}>" class="x-input form-control" vtype="required">
		</div>
		  
	<div class="tab-style1">
		<div class="form-group">
		  <label for="" > <{t}>法人地址：<{/t}></label>
		 <span class="hide"><{$area|ship_area}></span><input type="text" name="p_addr" value="<{$addr}>" id="" size="50" class="x-input form-control action-fill-area">
		</div>	
		<div class="form-group">
		  <label for="" ><{t}>公司地址<{/t}><{t}>：<{/t}></label>
		 <{input type="region" name="area" value=$area app="ectools" callback="selectArea" class="form-control"}>
		</div>
		<div class="form-group">
		  <label for="" > <{t}>详细地址：<{/t}></label>
		  <span class="hide"><{$area|ship_area}></span><input type="text" name="addr" value="<{$addr}>" id="" size="50" class="x-input form-control action-fill-area">
		</div>	
		<div class="form-group">
		  <label for="" ><em class="text-warn">*</em><{t}>税务局登记号：<{/t}></label>
		  <input type="text" name="inn" value="<{$inn}>" id="" class="x-input form-control" vtype="required">
		</div>
		<div class="form-group changetext">
		  <label for="" ><em class="text-warn">*</em><{t}>工业企业编码：<{/t}></label>
		  <input type="text" name="kpp" value="<{$kpp}>" id="" class="x-input form-control" vtype="required">
		</div>
		<div class="form-group">
		  <label for="" > <{t}>国家基本登记号：<{/t}></label>
		 <input type="text" name="ogrn" value="<{$ogrn}>" id="" class="x-input form-control">
		</div>
		<div class="form-group">
		  <label for="" ><{t}>全俄企业组织目录：<{/t}></label>
		 <input type="text" name="okpo" value="<{$okpo}>" id="" class="x-input form-control">
		</div>
		<div class="form-group">
		  <label for="" ><{t}>开户行：<{/t}></label>
		 <input type="text" name="open_account" value="<{$open_account}>" id="" class="x-input form-control">
		</div>
		<div class="form-group">
		  <label for="" ><{t}>银行代码：<{/t}></label>
		 <input type="text" name="bik" value="<{$bik}>" id="" class="x-input form-control">
		</div>
		<div class="form-group">
		  <label for="" > <{t}>银行账号：<{/t}></label>
		  <input type="text" name="bank_no" value="<{$bank_no}>" id="" class="x-input form-control">
		</div>
		<div class="form-group">
		  <label for="" ><{t}>kc：<{/t}></label>
		  <input type="text" name="kc" value="<{$kc}>" id="" class="x-input form-control">
		</div>
	</div>
	<div class="tab-style2" style="display:none">
		<div class="form-group">
		  <label for="" ><em class="text-warn">*</em> <{t}>联系电话：<{/t}></label>
		  <div class="row">
			<div class="col-lg-3 col-md-3 col-sm-3 col-xs-3">
			<select name="phone_setting" id="quhao" class="form-control">
				<{foreach from=$phones item=items}>
				<option value="<{$items.area}>" sid="<{$items.length}>" <{if $phone_setting == $items.area}>selected<{/if}>><{$items.area}></option>
				<{/foreach}>
			</select>
			</div>
			<div class="col-lg-9 col-md-9 col-sm-9 col-xs-9">
			<input type="text" name="tel" value="<{$tel}>" id="check_mobile" class="x-input form-control" vtype="required"><span style="color:red" class="tips"></span>
			</div>
			</div>
		</div>

		<div class="form-group">
		  <label for="" ><{t}>税务局登记号：<{/t}></label>
		  <input type="text" name="inn_p" value="<{$inn_p}>" id="" class="x-input form-control">
		 </div> 

	</div>
	<div class="checkbox">
		<label for="for_set_default">
        <input type="checkbox" name="def_company" value="1" id="for_set_default" <{if $default eq "1"}>checked=checked<{/if}>>
        <{t}>设为默认<{/t}></label>
	</div>

	<div class="form-group">
   
        <button type="submit" class="btn btn-primary pull-right" rel="_request" id="btn1"><span><span><{t}>确定<{/t}></span></span></button>
        <button type="button" class="btn btn-default pull-right action-reset"><span><span><{t}>取消<{/t}></span></span></button>
		<div class="clearfix"></div>
	</div>	
</form>
<script>
//初始化进来显示菜单内容
var v = "<{$c_type}>";
if(v==3){
	$$('.tab-style1').setStyle('display','none');
	$$('.tab-style2').setStyle('display','block');
	$$('.tab-style1 input').set('value','');
}else{
	$$('.tab-style1').setStyle('display','block');
	$$('.tab-style2').setStyle('display','none');
	$$('.tab-style2 input').set('value','');
}


$$('.choice').addEvent('click',function(){
	if(this.value=='3'){
		$$('.tab-style1').setStyle('display','none');
		$$('.tab-style2').setStyle('display','block');
	}else{
		$$('.tab-style1').setStyle('display','block');
		$$('.tab-style2').setStyle('display','none');
	}
});

window.addEvent('domready',function(){
	$('check_mobile').addEvent('blur',function(){
		var str = this.get('value').trim();
		var obj = $$("#quhao option:selected");
		var num = obj[0].get('sid');
		var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");
		
		if(str.length!=0){
			if(!reg.test(str)){
				$$(".tips").set('html','<{t}>手机格式错误<{/t}>');
			}else{
				$$(".tips").set('html','');
			}
		}
	});
});

$("btn1").addEvent('click', function(e){
	var str = $('check_mobile').get('value').trim();
	var obj = $$("#quhao option:selected");
	var num = obj[0].get('sid');
	var reg = new RegExp("^[1-9]\\d{"+(num-1)+"}$");
    
	var is_checked = $$('.choice').get('checked');
	if(str.length != 0 && is_checked[3] == 'true'){
		if(!reg.test(str)){
			$$(".tips").set('html','<{t}>手机格式错误<{/t}>');
			e.stop();
		}else{
			$$(".tips").set('html','');
		}
	}
});
           if(jQuery('#o3').attr('checked')=='checked'){
               change2();
           };
            function change2(){
            jQuery('.changetext .text-warn').css('display','none');
            jQuery('.changetext input').removeAttr('vtype');
            }
             function change1(){
                  jQuery('.changetext .text-warn').css('display','inline-block');
                  jQuery('.changetext input').attr('vtype','required');
             }
</script>